﻿                                                                                                   

         
	using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Linq;
    using System.Linq.Dynamic;
    using System.Text;
    using System.Threading.Tasks;
    using Abp;
    using Abp.Application.Services.Dto;
    using Abp.Authorization;
    using Abp.AutoMapper;
    using Abp.Configuration;
    using Abp.Domain.Repositories;
    using Abp.Extensions;
    using Abp.Linq.Extensions;
    using KDS.Mes.Mes.TestRlifts.Dtos;
using KDS.Mes.DataExporting.Excel.EpPlus;
using Abp.Timing.Timezone;
using Abp.Runtime.Session;
using KDS.Mes.Dto;
#region 代码生成器相关信息_ABP Code Generator Info
//你好，我是ABP代码生成器的作者,欢迎您使用该工具，目前接受付费定制该工具，有需要的可以联系我
//我的邮箱:werltm@hotmail.com
// 官方网站:"http://www.yoyocms.com"
// 交流QQ群：104390185  
//微信公众号：角落的白板报
// 演示地址:"vue版本：http://vue.yoyocms.com angularJs版本:ng1.yoyocms.com"
//博客地址：http://www.cnblogs.com/wer-ltm/
//代码生成器帮助文档：http://www.cnblogs.com/wer-ltm/p/5777190.html
// <Author-作者>梁桐铭 ,微软MVP</Author-作者>
// Copyright © YoYoCms@China.2017-10-24T19:30:07. All Rights Reserved.
//<生成时间>2017-10-24T19:30:07</生成时间>
#endregion
namespace KDS.Mes.Mes.TestRlifts
{
    /// <summary>
    /// 电装检测数据表的导出EXCEL功能的实现
    /// </summary>
    public class TestRliftListExcelExporter : EpPlusExcelExporterBase, ITestRliftListExcelExporter
    {
     
        private readonly ITimeZoneConverter _timeZoneConverter;
        private readonly IAbpSession _abpSession;


        /// <summary>
        /// 构造方法
        /// </summary>
        public TestRliftListExcelExporter(ITimeZoneConverter timeZoneConverter,     IAbpSession abpSession)
        {
                       _timeZoneConverter = timeZoneConverter;    
                     _abpSession = abpSession;
        }

    

         /// <summary>
        /// 导出电装检测数据表到EXCEL文件
        /// <param name="testRliftListDtos">导出信息的DTO</param>
        /// </summary>
    public    FileDto ExportTestRliftToFile(List<TestRliftListDto> testRliftListDtos){


var file=CreateExcelPackage("testRliftList.xlsx",excelPackage=>{

var sheet=excelPackage.Workbook.Worksheets.Add(L("TestRlift"));
                    sheet.OutLineApplyStyle = true;

                    AddHeader(
                        sheet,
                          L("LINE"),  
     L("STATION_NO"),  
     L("SEAT_ID"),  
     L("RESULT"),  
     L("RECL_FWD_SPD"),  
     L("RECL_FWD_CUR"),  
     L("RECL_FWD_JUG"),  
     L("RECL_BWD_SPD"),  
     L("RECL_BWD_CUR"),  
     L("RECL_BWD_JUG"),  
     L("SLIDE_FWD_SPD"),  
     L("SLIDE_FWD_CUR"),  
     L("SLIDE_FWD_JUG"),  
     L("SLIDE_BWD_SPD"),  
     L("SLIDE_BWD_CUR"),  
     L("SLIDE_BWD_JUG"),  
     L("FLIFT_FWD_SPD"),  
     L("FLIFT_FWD_CUR"),  
     L("FLIFT_FWD_JUG"),  
     L("FLIFT_BWD_SPD"),  
     L("FLIFT_BWD_CUR"),  
     L("FLIFT_BWD_JUG"),  
     L("RLIFT_FWD_SPD"),  
     L("RLIFT_FWD_CUR"),  
     L("RLIFT_FWD_JUG"),  
     L("RLIFT_BWD_SPD"),  
     L("RLIFT_BWD_CUR"),  
     L("RLIFT_BWD_JUG"),  
     L("LUMB1_FWD_CUR"),  
     L("LUMB1_FWD_JUG"),  
     L("LUMB1_BWD_CUR"),  
     L("LUMB1_BWD_JUG"),  
     L("LUMB2_UP_CUR"),  
     L("LUMB2_UP_JUG"),  
     L("LUMB2_DOWN_CUR"),  
     L("LUMB2_DOWN_JUG"),  
     L("NOISE_VAL"),  
     L("NOISE_JUG"),  
     L("VENT_HOT_OFF_VAL"),  
     L("VENT_HOT_OFF_JUG"),  
     L("VENT_HOT_ON_VAL"),  
     L("VENT_HOT_ON_JUG"),  
     L("VENT_HOT_LED_OFF_VAL"),  
     L("VENT_HOT_LED_HI_VAL"),  
     L("VENT_HOT_LED_MID_VAL"),  
     L("VENT_HOT_LED_LOW_VAL"),  
     L("VENT_HOT_LED_JUG"),  
     L("VENT_COOL_OFF_VAL"),  
     L("VENT_COOL_OFF_JUG"),  
     L("VENT_COOL_ON_VAL"),  
     L("VENT_COOL_ON_JUG"),  
     L("VENT_COOL_LED_OFF_VAL"),  
     L("VENT_COOL_LED_HI_VAL"),  
     L("VENT_COOL_LED_MID_VAL"),  
     L("VENT_COOL_LED_LOW_VAL"),  
     L("VENT_COOL_LED_JUG"),  
     L("VENT_NOISE_VAL"),  
     L("VENT_NOISE_JUG"),  
     L("CREAT_TIME")  
                        );
         AddObjects(sheet,2,testRliftListDtos,
            
      _ => _.LINE,   
       
      _ => _.STATION_NO,   
       
      _ => _.SEAT_ID,   
       
      _ => _.RESULT,   
       
      _ => _.RECL_FWD_SPD,   
       
      _ => _.RECL_FWD_CUR,   
       
      _ => _.RECL_FWD_JUG,   
       
      _ => _.RECL_BWD_SPD,   
       
      _ => _.RECL_BWD_CUR,   
       
      _ => _.RECL_BWD_JUG,   
       
      _ => _.SLIDE_FWD_SPD,   
       
      _ => _.SLIDE_FWD_CUR,   
       
      _ => _.SLIDE_FWD_JUG,   
       
      _ => _.SLIDE_BWD_SPD,   
       
      _ => _.SLIDE_BWD_CUR,   
       
      _ => _.SLIDE_BWD_JUG,   
       
      _ => _.FLIFT_FWD_SPD,   
       
      _ => _.FLIFT_FWD_CUR,   
       
      _ => _.FLIFT_FWD_JUG,   
       
      _ => _.FLIFT_BWD_SPD,   
       
      _ => _.FLIFT_BWD_CUR,   
       
      _ => _.FLIFT_BWD_JUG,   
       
      _ => _.RLIFT_FWD_SPD,   
       
      _ => _.RLIFT_FWD_CUR,   
       
      _ => _.RLIFT_FWD_JUG,   
       
      _ => _.RLIFT_BWD_SPD,   
       
      _ => _.RLIFT_BWD_CUR,   
       
      _ => _.RLIFT_BWD_JUG,   
       
      _ => _.LUMB1_FWD_CUR,   
       
      _ => _.LUMB1_FWD_JUG,   
       
      _ => _.LUMB1_BWD_CUR,   
       
      _ => _.LUMB1_BWD_JUG,   
       
      _ => _.LUMB2_UP_CUR,   
       
      _ => _.LUMB2_UP_JUG,   
       
      _ => _.LUMB2_DOWN_CUR,   
       
      _ => _.LUMB2_DOWN_JUG,   
       
      _ => _.NOISE_VAL,   
       
      _ => _.NOISE_JUG,   
       
      _ => _.VENT_HOT_OFF_VAL,   
       
      _ => _.VENT_HOT_OFF_JUG,   
       
      _ => _.VENT_HOT_ON_VAL,   
       
      _ => _.VENT_HOT_ON_JUG,   
       
      _ => _.VENT_HOT_LED_OFF_VAL,   
       
      _ => _.VENT_HOT_LED_HI_VAL,   
       
      _ => _.VENT_HOT_LED_MID_VAL,   
       
      _ => _.VENT_HOT_LED_LOW_VAL,   
       
      _ => _.VENT_HOT_LED_JUG,   
       
      _ => _.VENT_COOL_OFF_VAL,   
       
      _ => _.VENT_COOL_OFF_JUG,   
       
      _ => _.VENT_COOL_ON_VAL,   
       
      _ => _.VENT_COOL_ON_JUG,   
       
      _ => _.VENT_COOL_LED_OFF_VAL,   
       
      _ => _.VENT_COOL_LED_HI_VAL,   
       
      _ => _.VENT_COOL_LED_MID_VAL,   
       
      _ => _.VENT_COOL_LED_LOW_VAL,   
       
      _ => _.VENT_COOL_LED_JUG,   
       
      _ => _.VENT_NOISE_VAL,   
       
      _ => _.VENT_NOISE_JUG,   
       
 _ =>_timeZoneConverter.Convert( _.CREAT_TIME,_abpSession.TenantId, _abpSession.GetUserId())
);
                    //写个时间转换的吧
          //var creationTimeColumn = sheet.Column(10);
                    //creationTimeColumn.Style.Numberformat.Format = "yyyy-mm-dd";

        for (var i = 1; i <= 59; i++)
                    {
                        sheet.Column(i).AutoFit();
                    }       

});
   return file;

}


 

 
  

    }
    }
